/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vistas;


import Controladores.ControladorCliente;
import Controladores.ControladorUsuarios;
import Login.Login;
import Imagenes.CtrlImagen;


/**
 *
 * @author EthanR
 */
public class Menu extends javax.swing.JFrame {

    /**
     * Creates new form Menu
     */

    ControladorCliente cc = new ControladorCliente();
    ControladorUsuarios cu = new ControladorUsuarios();
    public Menu() {
      initComponents();
      jLabel2.setText(cu.Nomrbre(Login.Usu, Login.Pass));
      jLabel4.setText(cu.TipoUsu(Login.Usu, Login.Pass));
      
      if(cu.TipoUsu(Login.Usu, Login.Pass).equals("Vendedor")){
          this.jMProductos.setEnabled(false);
          jMClientes.setEnabled(false);
          jMCategoria.setEnabled(false);
          jMUsuario.setEnabled(false);
      }
      
      
      
      
              
             
    }
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new CtrlImagen("/Imagenes/merceria-5.jpg");
        jPanelTransparente1 = new Imagenes.JPanelTransparente();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLBLCerrarSesion = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMProductos = new javax.swing.JMenu();
        jMProductosCrear = new javax.swing.JMenuItem();
        jMProductosModificar = new javax.swing.JMenuItem();
        jMProductosEliminar = new javax.swing.JMenuItem();
        jMProductosListar = new javax.swing.JMenuItem();
        jMClientes = new javax.swing.JMenu();
        jMClientesCrear = new javax.swing.JMenuItem();
        jMClientesModificar = new javax.swing.JMenuItem();
        jMClientesEliminar = new javax.swing.JMenuItem();
        jMClientesListar = new javax.swing.JMenuItem();
        jMCategoria = new javax.swing.JMenu();
        jMCategoriasCrear = new javax.swing.JMenuItem();
        jMUsuario = new javax.swing.JMenu();
        jMUsuarioCrear = new javax.swing.JMenuItem();
        jMUsuarioModificar = new javax.swing.JMenuItem();
        jMUsuarioEliminar = new javax.swing.JMenuItem();
        jMUsuarioListar = new javax.swing.JMenuItem();
        jMVentas = new javax.swing.JMenu();
        jMVentasRealizar = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Menu Principal");

        jPanelTransparente1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Usuario", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel1.setText("USUARIO:");

        jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 0, 0));
        jLabel2.setText("jLabel2");

        jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel3.setText("TIPO DE USUARIO");

        jLabel4.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 0, 0));
        jLabel4.setText("jLabel2");

        jLBLCerrarSesion.setFont(new java.awt.Font("Arial", 3, 12)); // NOI18N
        jLBLCerrarSesion.setForeground(new java.awt.Color(255, 0, 0));
        jLBLCerrarSesion.setText("CERRAR SESION");
        jLBLCerrarSesion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLBLCerrarSesionMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanelTransparente1Layout = new javax.swing.GroupLayout(jPanelTransparente1);
        jPanelTransparente1.setLayout(jPanelTransparente1Layout);
        jPanelTransparente1Layout.setHorizontalGroup(
            jPanelTransparente1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTransparente1Layout.createSequentialGroup()
                .addGroup(jPanelTransparente1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelTransparente1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelTransparente1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanelTransparente1Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addContainerGap(41, Short.MAX_VALUE))))
            .addGroup(jPanelTransparente1Layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addComponent(jLBLCerrarSesion)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanelTransparente1Layout.setVerticalGroup(
            jPanelTransparente1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTransparente1Layout.createSequentialGroup()
                .addGroup(jPanelTransparente1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelTransparente1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                .addComponent(jLBLCerrarSesion))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(314, Short.MAX_VALUE)
                .addComponent(jPanelTransparente1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(127, Short.MAX_VALUE)
                .addComponent(jPanelTransparente1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMProductos.setText("Productos");

        jMProductosCrear.setText("CREAR");
        jMProductosCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMProductosCrearActionPerformed(evt);
            }
        });
        jMProductos.add(jMProductosCrear);

        jMProductosModificar.setText("MODIFICAR");
        jMProductosModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMProductosModificarActionPerformed(evt);
            }
        });
        jMProductos.add(jMProductosModificar);

        jMProductosEliminar.setText("ELIMINAR");
        jMProductosEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMProductosEliminarActionPerformed(evt);
            }
        });
        jMProductos.add(jMProductosEliminar);

        jMProductosListar.setText("LISTAR");
        jMProductosListar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMProductosListarActionPerformed(evt);
            }
        });
        jMProductos.add(jMProductosListar);

        jMenuBar1.add(jMProductos);

        jMClientes.setText("Clientes");

        jMClientesCrear.setText("CREAR");
        jMClientesCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMClientesCrearActionPerformed(evt);
            }
        });
        jMClientes.add(jMClientesCrear);

        jMClientesModificar.setText("MODIFICAR");
        jMClientesModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMClientesModificarActionPerformed(evt);
            }
        });
        jMClientes.add(jMClientesModificar);

        jMClientesEliminar.setText("ELIMINAR");
        jMClientesEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMClientesEliminarActionPerformed(evt);
            }
        });
        jMClientes.add(jMClientesEliminar);

        jMClientesListar.setText("LISTAR");
        jMClientesListar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMClientesListarActionPerformed(evt);
            }
        });
        jMClientes.add(jMClientesListar);

        jMenuBar1.add(jMClientes);

        jMCategoria.setText("Categorias");

        jMCategoriasCrear.setText("CREAR");
        jMCategoriasCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMCategoriasCrearActionPerformed(evt);
            }
        });
        jMCategoria.add(jMCategoriasCrear);

        jMenuBar1.add(jMCategoria);

        jMUsuario.setText("Usuarios");

        jMUsuarioCrear.setText("Crear");
        jMUsuarioCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMUsuarioCrearActionPerformed(evt);
            }
        });
        jMUsuario.add(jMUsuarioCrear);

        jMUsuarioModificar.setText("Modificar");
        jMUsuario.add(jMUsuarioModificar);

        jMUsuarioEliminar.setText("Eliminar");
        jMUsuario.add(jMUsuarioEliminar);

        jMUsuarioListar.setText("Listar");
        jMUsuario.add(jMUsuarioListar);

        jMenuBar1.add(jMUsuario);

        jMVentas.setText("Ventas");

        jMVentasRealizar.setText("Realizar");
        jMVentasRealizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMVentasRealizarActionPerformed(evt);
            }
        });
        jMVentas.add(jMVentasRealizar);

        jMenuBar1.add(jMVentas);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMClientesCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMClientesCrearActionPerformed
        // TODO add your handling code here:
            ClienteCrear Cc = new ClienteCrear();
            Cc.setLocationRelativeTo(Cc);
            Cc.setVisible(true);
                
    }//GEN-LAST:event_jMClientesCrearActionPerformed

    private void jMClientesModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMClientesModificarActionPerformed
        // TODO add your handling code here:
            ClienteModificar mc = new ClienteModificar();
            mc.setLocationRelativeTo(null);
            mc.setVisible(true);
    }//GEN-LAST:event_jMClientesModificarActionPerformed

    private void jMClientesEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMClientesEliminarActionPerformed
        // TODO add your handling code here:
         ClienteEliminar ec = new ClienteEliminar();
            ec.setLocationRelativeTo(null);
        ec.setVisible(true);
    }//GEN-LAST:event_jMClientesEliminarActionPerformed

    private void jMClientesListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMClientesListarActionPerformed
        // TODO add your handling code here:
        ClienteListar lc = new ClienteListar();
        lc.setLocationRelativeTo(null);
        lc.setVisible(true);
    }//GEN-LAST:event_jMClientesListarActionPerformed

    private void jMCategoriasCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMCategoriasCrearActionPerformed
        // TODO add your handling code here:
        CategoriaCrear c = new CategoriaCrear();
        c.setLocationRelativeTo(null);
        c.setVisible(true);
    }//GEN-LAST:event_jMCategoriasCrearActionPerformed

    private void jMProductosCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMProductosCrearActionPerformed
        // TODO add your handling code here:
        ProductosCrear pc = new ProductosCrear();
        pc.setLocationRelativeTo(null);
        pc.setVisible(true);
    }//GEN-LAST:event_jMProductosCrearActionPerformed

    private void jMProductosModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMProductosModificarActionPerformed
        // TODO add your handling code here:
        ProductosModificar Pm = new ProductosModificar();
        Pm.setLocationRelativeTo(null);
        Pm.setVisible(true);
    }//GEN-LAST:event_jMProductosModificarActionPerformed

    private void jMProductosEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMProductosEliminarActionPerformed
        // TODO add your handling code here:
        ProductosEliminar pe = new ProductosEliminar();
        pe.setLocationRelativeTo(null);
        pe.setVisible(true);
               
    }//GEN-LAST:event_jMProductosEliminarActionPerformed

    private void jMProductosListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMProductosListarActionPerformed
        // TODO add your handling code here:
        ProductosListar pl = new ProductosListar();
        pl.setLocationRelativeTo(null);
        pl.setVisible(true);
    }//GEN-LAST:event_jMProductosListarActionPerformed

    private void jMUsuarioCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMUsuarioCrearActionPerformed
        // TODO add your handling code here:
        UsuariosCrear uc = new UsuariosCrear();
        uc.setLocationRelativeTo(null);
        uc.setVisible(true);
    }//GEN-LAST:event_jMUsuarioCrearActionPerformed

    private void jLBLCerrarSesionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLBLCerrarSesionMouseClicked
        // TODO add your handling code here:
        this.dispose();
        Login l = new Login(); 
        l.setLocationRelativeTo(null);
        l.setVisible(true);
        
    }//GEN-LAST:event_jLBLCerrarSesionMouseClicked

    private void jMVentasRealizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMVentasRealizarActionPerformed
        // TODO add your handling code here:
        Venta v = new Venta();
        v.setLocale(null);
        v.setVisible(true);
    }//GEN-LAST:event_jMVentasRealizarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        
        /* Create and display the form */
          
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Menu().setVisible(true);
                
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLBLCerrarSesion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JMenu jMCategoria;
    private javax.swing.JMenuItem jMCategoriasCrear;
    private javax.swing.JMenu jMClientes;
    private javax.swing.JMenuItem jMClientesCrear;
    private javax.swing.JMenuItem jMClientesEliminar;
    private javax.swing.JMenuItem jMClientesListar;
    private javax.swing.JMenuItem jMClientesModificar;
    private javax.swing.JMenu jMProductos;
    private javax.swing.JMenuItem jMProductosCrear;
    private javax.swing.JMenuItem jMProductosEliminar;
    private javax.swing.JMenuItem jMProductosListar;
    private javax.swing.JMenuItem jMProductosModificar;
    private javax.swing.JMenu jMUsuario;
    private javax.swing.JMenuItem jMUsuarioCrear;
    private javax.swing.JMenuItem jMUsuarioEliminar;
    private javax.swing.JMenuItem jMUsuarioListar;
    private javax.swing.JMenuItem jMUsuarioModificar;
    private javax.swing.JMenu jMVentas;
    private javax.swing.JMenuItem jMVentasRealizar;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private Imagenes.JPanelTransparente jPanelTransparente1;
    // End of variables declaration//GEN-END:variables
}
